/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.log4j.Logger;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 *
 * @author PhucAn
 */
public class SeverAction implements ServletContextListener {
Logger log=Logger.getLogger(SeverAction.class);
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        try {
            ServletContext context=sce.getServletContext();
            InputStream is=context.getResourceAsStream("/WEB-INF/online_quiz_config.properties");
            Properties prop=new Properties();
            prop.load(is);
            String user=prop.getProperty("user");
            is.close();
            log.info("Online quiz app init successed");
        } catch (IOException ex) {
            log.info(ex.getMessage());
        }catch(Exception ex){
            log.info(ex.getMessage());
        }
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        
    }
    
}
